Ext.define('Pearlsen.form.action.PLoad', {
	 extend:'Ext.form.action.Load',
	 alias: 'formaction.pload',
	 run: function() {
		 var query = new Query(this.form.handlerName,this.form.datasetName);
		 query.setHandlerMethod(this.form.handlerMethod);		 
		 query.setURL(this.form.handlerURL);
		 query.setForm(this.form);
		 if( this.form.baseParams ) {
			 query.setConditions(this.form.baseParams);
		 }
		 var conditions = this.form.getConditions();
		 if( conditions  ){
			 for( var i=0;i<conditions.length;i++ ){
				 query.conditions.push(conditions[i]);
			 }
		 }
		 query.setCompletedFun( this.form.afterLoadHandler );
		 query.load();
	 },
	
    handleResponse: function(response) {
		 var rs = Ext.decode(response.responseText);
		 var data = rs.record && rs.record[0] ? rs.record[0] : null;
		 return  {
             success : rs.success,
             data : data
         };
    }
});